<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3-5-样式绑定-组合式</title>
</head>

<body>


    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>


    <style>
        .red {
            color: red;
            font-size: 2em;
        }

        .blue {
            color: blue;
        }

        .font {
            font-weight: bold;
        }
    </style>


    <div id="app">

        <h1>内联对象</h1>
        <div :class="{blue:isBlue,red:isRed}">
            示例文案
        </div>

        <h1>数据对象</h1>
        <div :class="style">
            示例文案
        </div>

        <h1>数组对象</h1>
        <div :class="[redClass,fontClass]">
            示例文案
        </div>
        <hr />

        <h1>绑定内联样式</h1>
        <div :style="{color:textColor,fontSize:textFont}">
            简单的一句话
        </div>

        <h1>绑定内联对象</h1>
        <div :style="styleNpc">
            简单的一句话
        </div>

        <h1>绑定内联数组对象</h1>
        <div :style="[styleRed,styleFont]">
            简简单单一句话
        </div>
    </div>

    <script>
        const App = {
            data() {
                return {
                    //内联对象
                    isBlue: true,
                    isRed: true,
                    //作为数据对象
                    style: {
                        blue: true,
                        red: false,
                    },
                    //数组
                    redClass: "red",
                    fontClass: "font",

                    //绑定内联样式
                    textColor: "green",
                    textFont: "50px",
                    //对象
                    styleNpc: {
                        color: "red",
                        fontSize: "100px",
                    },
                    //数组
                    styleRed: {
                        color: "red"
                    },
                    styleFont: {
                        fontSize: "100px"
                    }
                }
            }
        }
        Vue.createApp(App).mount("#app")
    </script>




</body>

</html>